<!-- /* Description for file.
 * 面试题目
 * @copyright     Copyright 2008-2010, PHInfo Services Inc. (http://www.phinfoservices.com)
 * @package       ues
 * @subpackage    ues/app/views/interviewquestions
 * @since         ues
 * @version       V0.0.1
 * @modifiedby    张海杰2011年0706
 * @lastmodified  张海杰2011年0706
 */
 -->
<?php
//echo $javascript->link ( 'jquery' );
echo $html->css ( 'jquery-validate/css/screen' );
?>

 <script type="text/javascript">

//添加验证
 $(document).ready(function() {
 	$.validator.setDefaults({       
 		 submitHandler: function(form) {    
 		  form.submit();    
 		}       
 	});   
 			
 	$("#InterviewquestionAddtestForm").validate({
 		rules: {
 		"data[Interviewquestion][name]":{
 			required: true,string:true,stringMinLength:0,stringMaxLength:50
 			},
		"data[Interviewquestion][score]":{
			required: true,score:true
			},
		"data[Interviewquestion][memo]":{
			required: false,string:true,stringMinLength:0,stringMaxLength:200
			}
 		},
 		messages:{maxitem:{required: "请输入"}},
 		focusInvalid:false,
 		onkeyup:false,
 		errorPlacement:function(error, element){error.appendTo(element.parent());}
 	});
 });
 //验证结束

 
//操作iframe中一些数据//
$(document).ready(function(){  
	$("#btnajaxAdd").click(function() {
//		if($("#InterviewquestionName").val()==''||$("#InterviewquestionScore").val()=='') 
//		{
//			alert("请填写试卷名称和分数！");
//			return;
//		}
//		else if($("#InterviewquestionScore").val()< 0 ||$("#InterviewquestionScore").val()> 100 )
//			{
//				alert("试卷分数请在（0~100）范围内！");
//				$("#InterviewquestionScore").val('');
//				return;
//			}
//		else 
			{ //post到后台提交新增试卷Addtestform
			$.post(
					'<?php echo ROOT_WEB_PATH; ?>/interviewquestions/addtest/',
					{
					},
					function()
					{	
						$("#InterviewquestionAddtestForm").submit();
	
					});
			}
		});
	self.parent.frames["Interview_tree"].location.reload();//到父窗口找到tree的iframe刷新数据
});  
</script>
<!--新增试卷-->
	<div class="tabflex">
	<?php echo $form->create('Interviewquestion',array('action'=>'addtest','type'=> 'post'));?>
		<fieldset><legend><?php __('Interviewquestion Add');?></legend>
		<table width="100%" cellspacing="0" cellpadding="0" border="0" style="text-align: left;font-size:12px;">
			<tr>
			<td>
			<?php
				echo $form->hidden('creater');
				echo $form->hidden('updater ');
				echo $form->hidden('fatherId',array('name'=>'fatherid','default'=>0));?> </td>
			</tr>
			<tr>
				<td width="50"></td>
				<td width="100"><?php __('InterviewquestionName');//名称?>:</td>
				<td >
				<?php echo $form->input('name',array('class' => 'TextBoxE1','label'=>false));?>
				</td>
			</tr>
			<tr>
				<td width="50"></td>
				<td width="100"><?php __('InterviewquestionScore');//分数?>:</td>
				<td >
				<?php echo $form->input('score',array('class' => 'TextBoxE1','label'=>false));?>
				</td>
			</tr>
			<tr>
				<td width="50"></td>
				<td width="100"><?php __('InterviewquestionMemo');//备注?>:</td>
				<td >
				<?php echo $form->textarea('memo',array('class' => 'areaStyle','label'=>false,'size'=>4));?>
				</td>
			</tr>
		</table>
			</fieldset>		
		<table width="50%" cellspacing="0" cellpadding="0" border="0" style="text-align: left">
			<tr>
				<td width="50"></td>
				<td width="40"><?php echo $form->button('重置',array('type'=>'reset','class'=>'resetsubmit'));?> <!-- __('reset', true)取消-->
				</td>

				<td width="40"><?php echo $form->button('确定',array('type'=>'button','class'=>'oksubmit','id'=>'btnajaxAdd'));?>		
				<!-- __('Add', true)增加--></td>
				</td>
				<td></td>
			</tr>
		</table>

	<?php echo $form->end();?>
	</div>	

<!--新增试卷-->